package indi.zhifa.core.auth.util.impl;

import indi.zhifa.core.auth.util.IAuthUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

@RequiredArgsConstructor
@Component
public class AuthUtilImpl implements IAuthUtil {

    final PasswordEncoder mPasswordEncoder;

    @Override
    public boolean passwdMatch(String passwd, String pDbPasswd) {
        return mPasswordEncoder.matches(passwd, pDbPasswd);
    }

    @Override
    public String encodePasswd(String passwd) {
        return mPasswordEncoder.encode(passwd);
    }
}
